<script>
$(document).ready(function(){
        $(".expand_body").hide();
	$('.expand_head').click(function(){
                $(this).next('.expand_body').slideToggle(60);
	});
});
</script>
<?php 

    foreach ($documetacaoList->getResult() as $key=>$valueDoc) {
        
        $tipoDoc = $this->em->find('models\tipo_documento',$valueDoc->getTipoDocCod());
        
        $background = ($key%2==0) ? 'style="background-color:#F6F6F6"' : ''; 
        
        if($tipoDoc->getGrupo() == 1){
          unset($dtExp);
          
          $ufGrupo1 = $this->em->find('models\uf',$valueDoc->getUfCod());
          
          $dtExp = explode('-',@$valueDoc->getDataEmissao());
          $dtExp = $dtExp[2].'/'.$dtExp[1].'/'.$dtExp[0];
?>

        <table  cellpadding="0" cellspacing="1" border="0" width="709" <?= $background?> >
<tr class="expand_head" id="tr1_doc_"<?= @$valueDoc->getDocumentoId()?> >
                <td><div align="left"><strong>Tipo Doc: </strong></div></td>
                <td colspan="4"><?= utf8_encode($tipoDoc->getTipoDocDesc()) ?></td>
                <td>Descri&ccedil;&atilde;o:</td>
                <td colspan="6"><input type="text" id="descricaoCert<?= @$valueDoc->getDocumentoId() ?>" size="40" maxlength="40" value="<?= utf8_encode(@$valueDoc->getDocDescricao()) ?>" /></td>
                <td><img alt="mais" src="<?php echo base_url() . 'assets/images/mais.png' ?>" border="0" title="Detalhar"  width="13" height="12"/></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
</tr>
            <tr class="expand_body" id="tr2_doc_"<?= @$valueDoc->getDocumentoId()?>>
                <td width="9%"><div id="expedidorCert">Expedidor:</div></td>
                <td width="9%">   
                  <input type="text" id="expedidorCert<?= @$valueDoc->getDocumentoId() ?>" size="10" maxlength="10" value="<?= @$valueDoc->getEmissor() ?>" />        </td>
                <td width="3%"><div align="right">UF:</div></td>
                <td width="6%">
                  <select id="ufCert<?= @$valueDoc->getDocumentoId() ?>">
                      <option value="<?= $valueDoc->getUfCod() ?>"><?= $ufGrupo1->getUfSigla() ?></option>
                      <?php $this->load->view('uf/cbo_uf'); ?>
                  </select>        </td>
                <td width="7%"><div align="right">Data Exp:</div></td>
            <td width="9%">
                <input type="text" id="dataExpCert<?= @$valueDoc->getDocumentoId() ?>" class="datepicker" size="8" maxlength="8" value="<?= @$dtExp ?>" />        </td>
              <td width="6%"><div align="right">Termo:</div></td>
            <td width="5%">
                <input type="text" id="termoCert<?= @$valueDoc->getDocumentoId() ?>" size="5" maxlength="5" value="<?= @$valueDoc->getTermo() ?>" />        </td>
              <td width="5%"><div align="right">Folha:</div></td>
            <td width="5%">
                <input type="text" id="folhaCert<?= @$valueDoc->getDocumentoId() ?>" size="5" maxlength="5"  value="<?= @$valueDoc->getFolha() ?>"/>        </td>
              <td width="5%"><div align="right">Livro:</div></td>
              <td width="21%"><input type="text" id="livroCert<?= @$valueDoc->getDocumentoId() ?>" size="5" maxlength="5" value="<?= @$valueDoc->getLivro() ?>" /></td>
              <td width="7%">&nbsp;</td>
              <td width="1%">&nbsp;</td>
              <td width="1%">&nbsp;</td>
              <td width="1%">&nbsp;</td>
          </tr>
        </table>
<?php
        } else if($tipoDoc->getGrupo() == 2){
            unset($dtExp);
            $ufGrupo2 = $this->em->find('models\uf',$valueDoc->getUfCod());
            
            $dtExp = explode('-',@$valueDoc->getDataEmissao());
            $dtExp = $dtExp[2].'/'.$dtExp[1].'/'.$dtExp[0];
           
 ?>
            <table width="711" border="0"  cellpadding="0" cellspacing="1" <?= $background?> >
              <tr class="expand_head" id="tr3_doc_"<?= @$valueDoc->getDocumentoId()?>>
                <td><div align="left"><strong>Tipo Doc: </strong></div></td>
                <td colspan="3"><?= utf8_encode($tipoDoc->getTipoDocDesc()) ?></td>
                <td><div align="right">Descri&ccedil;&atilde;o: </div></td>
                <td colspan="6"><input type="text" id="descricaoDocGeral<?= @$valueDoc->getDocumentoId() ?>" size="40" maxlength="40" value="<?= utf8_encode(@$valueDoc->getDocDescricao()) ?>"/></td>
                <td width="9%"><img alt="mais" src="<?php echo base_url() . 'assets/images/mais.png' ?>" border="0" title="Detalhar"  width="13" height="12"/></td>
              </tr>
              <tr class="expand_body" id="tr4_doc_"<?= @$valueDoc->getDocumentoId()?> >
                <td width="9%"><div id="expedidorDocGeral">
                  <div align="right">Expedidor:</div>
                </div></td>
                <td width="8%"> 
                    <input type="text" id="expedidorDocGeral<?= @$valueDoc->getDocumentoId() ?>" class="datepicker" size="10" maxlength="10" value="<?= @$valueDoc->getEmissor(); ?>" />                </td>
                <td width="3%">
                <div align="right">UF:</div></td>
                <td width="10%">
                    <select id="ufDocGeral<?= @$valueDoc->getDocumentoId() ?>">
                        <option value="<?= @$valueDoc->getUfCod() ?>"><?= $ufGrupo2->getUfSigla() ?></option>
                        <?php $this->load->view('uf/cbo_uf'); ?>
                    </select>                </td>
                <td width="10%"><div align="right">Data Exp:</div></td>
                <td width="21%"><input type="text" id="dataExpDocGeral" size="10" maxlength="10" value="<?= @$dtExp; ?>" /></td>
                <td width="1%">&nbsp;</td>
                <td width="14%">&nbsp;</td>
                <td width="1%">&nbsp;</td>
              </tr>
            </table>
<?php
        } else if($tipoDoc->getGrupo() == 3){
        
?>
            
            <table width="709" border="0"  cellpadding="0" cellspacing="1" <?= $background?> >
              <tr class="expand_head" id="tr5_doc_<?= @$valueDoc->getDocumentoId();?>" >
                <td width="9%"><div align="left">
                  <div align="left"><strong>Tipo Doc: </strong></div>
                </div></td>
                <td width="22%"><?= utf8_encode(@$tipoDoc->getTipoDocDesc()) ?></td>
                <td width="9%">Descri&ccedil;&atilde;o:</td>
                <td width="53%"><input type="text" id="descricaoOutroDoc<?= @$valueDoc->getDocumentoId() ?>" size="40" maxlength="40" value="<?= utf8_encode(@$valueDoc->getDocDescricao()) ?>" /></td>
              <tr class="expand_body" id="tr6_doc_<?= @$valueDoc->getDocumentoId()?>">
               	  <td colspan="7" ><div align="left"></div></td>
                <td width="1%">&nbsp;</td>
              </tr>
            </table>
<?php
        }
}

?>